home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / The Director v1.2.adf / Scripts / blitutil next >
Text File  |  1988-05-08  |  4KB  |  169 lines

  1. rem blitutil  1/8/88
  2. rem
  3. rem  file creation additions suggested by Dr. Sidney Soclof
  4.  
  5.     array 200,1
  6.     abort 0
  7.     print
  8.     print "a BLIT command utility"
  9.     print "This Director sequence is an example of a utility"
  10.     print "created with the Director to make it easier to figure"
  11.     print "the parameters for rectangle copy animations using the"
  12.     print "BLIT, DISSOLVE or WIPE commands."
  13.     print
  14.     print "BLITUTIL will ask you for the name of the 'background'"
  15.     print "file (the file to copy the rectangle(s) to), and the"
  16.     print "name of the 'objects' file (the source of the rectangle(s))"
  17.     print "After following the instructions and correctly positioning"
  18.     print "the rectangle, when BLITUTIL exits, it will display the"
  19.     print "parameters to a BLIT command to be used to copy the"
  20.     print "rectangle(s) as specified.  In addition, these commands""
  21.     print "will be written to a file called RAM:BB that can be inserted"
  22.     print "directly into your scripts using your editor."
  23. 10    print
  24.     print "Background file name? (quit to exit)"
  25.     incli $0,30
  26.     print
  27.     compare a,"quit",$0
  28.     if a:end:endif
  29.     compare a,"QUIT",$0
  30.     if a:end:endif
  31.     a=0
  32.     open a,$0
  33.     if a=0:print "File not found":goto 10:endif
  34.     close
  35.     setblack 1
  36.     load 2,$0
  37.     new 1,2
  38.     display 1
  39.     resolution -1,xrs,yrs,bplanes
  40.     if ((xrs > 320) & (xrs < 640)) | (xrs > 640)
  41.         position -1,-1    :rem  looks like overscan
  42.     endif
  43.     setblack 0
  44. 30    clear:pen 1,31:move 0,20:text "Objects file name? (quit to exit)"
  45.     move 10,40:input $0,30
  46.     compare a,"quit",$0
  47.     if a:end :endif
  48.     compare a,"QUIT",$0
  49.     if a:end :endif
  50.     a=0:open a,$0
  51.     if a=0:move 10,40:text "File not found":pause 20:goto 30:endif
  52.     close
  53.     load 3,$0
  54.     clear:move 10,20:text "Transparency on?"
  55.     move 10,40:input $0,30
  56.     trans=0
  57.     compare a,"Y*",$0
  58.     if a:trans=1:endif
  59.     compare a,"y*",$0
  60.     if a:trans=1:endif
  61.     pointer 1
  62.     TXT=1:N=1:v=1:open v,"RAM:BB"
  63. 90    clear
  64.     if TXT
  65.         move 10,20:text "Pick upper left coordinate"
  66.         move 10,40:text "then lower right coordinate,"
  67.         move 10,60:text "you can readjust the resultant"
  68.         move 10,80:text "rectangle by re-clicking near"
  69.         move 10,100:text "these corners once the rectangle"
  70.         move 10,110:text "appears...."
  71.         gosub 400
  72.     endif
  73.     display 3
  74.     resolution -1,xres,yres,bplanes
  75.     getmouse x,y
  76.     xv=(x-1)~0:yv=(y-1)~0
  77.     drawmode 2
  78.     pen 1,31
  79.     move xv,yv:if x>0:draw xv+10,yv:endif
  80.     move xv,yv:if y>0:draw xv,yv+10:endif
  81.     getmouse w,h
  82.     move xv,yv:if x>0:draw xv+10,yv:endif
  83.     move xv,yv:if y>0:draw xv,yv+10:endif
  84.  
  85. 87    xv=x-1:yv=y-1
  86.     gosub 300:rem  draw the box
  87. 88    pause 1:ifkey char:if char=13:goto 89:endif
  88.     ifmouse xt,yt:if xt=-1:goto 88:endif
  89.     gosub 300:rem  draw the box
  90.     if !(xt-x)+!(yt-y) > !(xt-w)+!(yt-h):w=xt:h=yt
  91.     else:x=xt:y=yt:endif
  92.     goto 87
  93.  
  94. 89    gosub 300:rem  draw the box
  95.     drawmode -1
  96.     w = w-x
  97.     h = h-y
  98.     display 1
  99.     clear
  100.     if TXT
  101.         move 10,20:text "Now select target approximate"
  102.         move 10,40:text "upper left position, and use"
  103.         move 10,60:text "the keyboard arrow keys to"
  104.         move 10,80:text "adjust the positioning accurately."
  105.         move 10,110:text "Hit <return> when done."
  106.         gosub 400
  107.     endif
  108.     copy 2,1
  109.     getmouse X,Y
  110. 23    transparent trans
  111.     blit 3,x,y,X,Y,w,h
  112.     transparent 0
  113. 20    display 2
  114.     pause 1
  115.     display 1
  116.     pause 1
  117.     ifmouse xx,yy
  118.     if xx#-1:goto 24:endif
  119.     ifkey c
  120.     if c=13:goto 100:endif
  121.     if c#-101:goto 20:endif
  122.     getkey c
  123. 24    blit 2,X,Y,X,Y,w,h
  124.     if xx#-1:X=xx:Y=yy:endif
  125.     if c=67:X=X+1:endif
  126.     if c=68:X=X-1:endif
  127.     if c=66:Y=Y+1:endif
  128.     if c=65:Y=Y-1:endif
  129.     goto 23
  130. 100    print " BLIT buff,";x;",";y;",";X;",";Y;",";w;",";h
  131.     write " BLIT buff,";x;",";y;",";X;",";Y;",";w;",";h
  132.     display 2
  133.     blit 1,0,0,0,0,-1,-1
  134.     display 1
  135.     clear
  136.     move 25,100:text "BLIT NUMBER: ";N;" DONE"
  137.     a=20:b=20:gosub 200:move 30,50:text "MORE"
  138.     a=90:b=20:gosub 200:move 100,50:text "DONE"
  139. 110    getmouse a,b
  140.     if (b<20)|(b>70):goto 110:endif
  141.     if (a<20)|(a>140):goto 110:endif
  142.     if (a>70)&(a<90):goto 110:endif
  143.     if (a<90):N=N+1:TXT=0:goto 90:endif
  144.     CLOSE:end
  145.  
  146. 200 rem do a box
  147.     move a,b
  148.     draw a+50,b
  149.     draw a+50,b+50
  150.     draw a,b+50
  151.     draw a,b
  152.     return
  153.  
  154. 300 rem box routine with clipping
  155.     if xv>-1:move xv,0~yv:draw xv,yres_h:endif
  156.     if h<xres:move 0~xv,h:draw xres_w,h:endif
  157.     if w<xres:move w,yres_h:draw w,0~yv:endif
  158.     if yv>-1:move xres_w,yv:draw 0~xv,yv:endif
  159.     return
  160.  
  161. 400 rem  click on text ok box
  162.     pen 1,31
  163.     move 10,yrs-20:draw 50,yrs-20:draw 50,yrs-5:draw 10,yrs-5:draw 10,yrs-20
  164.     move 20,yrs-10:text "OK"
  165.     getmouse X,Y    :rem  any click will do, don't bother to check bounds
  166.     return
  167.  
  168.     end
  169.